<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Animation</title>
    <script src="../dist/zrender.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
        html, body, #main {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <div id="main"></div>
    <script type="text/javascript">
        var main = document.getElementById('main');
        // 初始化zrender
        var zr = zrender.init(main);

        var gradient = new zrender.LinearGradient();
        gradient.addColorStop(0, 'red');
        gradient.addColorStop(1, 'black');


        var gradient2 = new zrender.LinearGradient();
        gradient2.addColorStop(0, 'black');
        gradient2.addColorStop(0.5, 'blue');
        gradient2.addColorStop(1, 'white');

        var circle = new zrender.Circle({
            position: [100, 100],
            scale: [1, 1],
            shape: {
                cx: 50,
                cy: 50,
                r: 50
            },
            style: {
                fill: gradient,
                lineWidth: 5
            },
            textContent: new zrender.Text({
                style: {
                    fill: 'white',
                    text: 'Circle'
                }
            }),
            textConfig: {
                position: 'inside'
            }
        });
        zr.add(circle);

        circle.animate('')
            .when(200, {
                position: [200, 0]
            })
            .start();
        circle.animate('style', true)
            .when(1000, {
                fill: gradient2
            })
            .start();
        circle.animate('', true)
            .when(1000, {
                position: [200, 0]
            })
            .when(2000, {
                position: [200, 200]
            })
            .when(3000, {
                position: [0, 200]
            })
            .when(4000, {
                position: [100, 100]
            })
            .start();
    </script>
</body>
</html>